<?php

if(isset($_POST['updateseo']))
{
	$urlHomePage =  $_POST['urlHomePage'];
	$urlComposeAssignment =  $_POST['urlComposeAssignment'];
	mysql_query("UPDATE video  SET url = '$urlHomePage' where id='1'") or die(mysql_error());
	mysql_query("UPDATE video  SET url = '$urlComposeAssignment' where id='2'") or die(mysql_error());
	//echo "<script>window.location='index.php?tc=video&_s=1'</script>";
}
?>
<?php if($_REQUEST['_s'] == 1){ ?>
    <div class="sucmsg"><img src="images/information.png" align="absmiddle" />&nbsp;Successfully saved.</div>
<?php } ?>
<?php if($_REQUEST['_e'] == 1){ ?>
    <div class="sucmsg"><img src="images/error.png" align="absmiddle" />&nbsp;</div>
<?php } ?>
<?php 

$ssql="select * from video";
$ssql=mysql_query($ssql);
//$row = mysql_fetch_array($ssql);
$urlVideoHomePage = '';
$urlVideoComposeAssignment = '';
while ($row = mysql_fetch_array($ssql)) {	
    if ($row['id'] == 1)
    {
    	$urlVideoHomePage = $row['url'];
    }
	else if ($row['id'] == 2)
	{
		$urlVideoComposeAssignment = $row['url'];
	}  
}
?>
<form name="up" action="#" method="post" onSubmit="return validate()">
	<input type="hidden" name="hid" value="<?php echo  $row['id'];?>" />
	<table width="99%" align="center" border="0" class="list" cellpadding="5">		
		<thead>
			<tr>
				<td colspan="3" align="left">
	        		<div style="float:left" class="righthead">Video  Settings</div>
	    		</td>
			</tr>
		</thead>
		<tbody>
			<tr>
	    		<td align="left"  valign="top" width="20%">
	    		Video URL in Home Page<br /><span style="color:#666; font-size:14px;">Recommended Height:212,width:295 </span></td>
	        	<td>
	        		<textarea name="urlHomePage" id="url" style="width:462px; height:200px;"><?php echo $urlVideoHomePage;?></textarea>
	    		</td>
	    		<td>
	   				<img src="images/eg.gif" border="0px" />
	    		</td>
			</tr>
			<tr>
	    		<td align="left"  valign="top" width="20%">
	    		Video in Assigment<br /><span style="color:#666; font-size:14px;">Recommended Height:212,width:295 </span></td>
	        	<td>
	        		<textarea name="urlComposeAssignment" id="url" style="width:462px; height:200px;"><?php echo $urlVideoComposeAssignment;?></textarea>
	    		</td>
	    		<td>
	   				<img src="images/eg.gif" border="0px" />
	    		</td>
			</tr>
			<tr>
				<td colspan="3" style="padding-left:195px;">	    	
	          		<input type="submit" value="Update" name="updateseo" >
	    		</td>
			</tr>      
		</tbody>  
	</table>   
</form> 
